import request from '@/axios'
import { SysMenuDetailVo, SysMenuEditQo, SysMenuListVo, SysMenuSearchQo } from './types'
import { BaseDeleteQo } from '@/base/api/BaseQo'
import { KeyLabelValueVo } from '@/base/api/KeyLabelValueVo'

export const sysMenuPageApi = (data: SysMenuSearchQo): Promise<IResponse<Array<SysMenuListVo>>> => {
  return request.post({ url: '/sysMenu/page.adw', data })
}

export const sysMenuDetailApi = (id: number): Promise<IResponse<SysMenuDetailVo>> => {
  const data = { id }
  return request.post({
    url: '/sysMenu/detail.adw',
    data
  })
}

export const sysMenuAddApi = (data: SysMenuEditQo): Promise<IResponse<number>> => {
  return request.post({ url: '/sysMenu/add.adw', data })
}

export const sysMenuUpdateApi = (data: SysMenuEditQo): Promise<IResponse<void>> => {
  return request.post({ url: '/sysMenu/update.adw', data })
}

export const sysMenuDeleteApi = (data: BaseDeleteQo): Promise<IResponse<void>> => {
  return request.post({ url: '/sysMenu/delete.adw', data })
}

export const sysMenuCloneApi = (data: SysMenuSearchQo): Promise<IResponse<any>> => {
  return request.post({ url: '/sysMenu/clone.adw', data })
}

export const sysMenuChooseTitleCascadeApi=(data: SysMenuSearchQo): Promise<IResponse<any>> => {
  return request.post({ url: '/sysMenu/chooseTitleCascade.adw', data })
}

// [[ OnflowGenerator Range (- selectFunctions -) Start ]]
export const selectSysMenuTitleListApi = (
  data: SysMenuSearchQo
): Promise<IResponse<Array<KeyLabelValueVo>>> => {
  return request.post({ url: '/sysMenu/selectTitleList.adw', data })
}
export const selectSysMenuNameListApi = (
  data: SysMenuSearchQo
): Promise<IResponse<Array<KeyLabelValueVo>>> => {
  return request.post({ url: '/sysMenu/selectNameList.adw', data })
}
// [[ OnflowGenerator Range (- selectFunctions -) End ]]
